﻿<!DOCTYPE html>
<html lang="zxx">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <meta content="" name="description">
        <meta content="" name="keywords">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="HandheldFriendly" content="true">
        <meta content="telephone=no" name="format-detection">
        <!-- favicon -->
        <link rel="shortcut icon" type="image/png" href="favicon.png" />
        <!--[if (gt IE 9)|!(IE)]><!-->
        <!-- custom CSS -->
        <link href="css/main.css" rel="stylesheet" type="text/css" />
        <!-- END custom CSS -->
        <!--<![endif]-->
        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
            <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
            <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->
        <title>联盟资讯</title>
    </head>
    <body>
        <!-- Header -->
        {include file="public/header"}
        <!-- END header -->
        <!-- header slider -->
        <div class="wrapper">
            <article class="container articles">
                <div class="row">
                    <div class="col-sm-4 col-md-3 right_sidebar hidden-xs hidden-sm" data-spy="affix" data-offset-top="112" data-offset-bottom="80">
                        <div class="news-tabs">
                            <p class="news-tabs__title h2">最新评论</p>
                            {if count($new_comment) > 0}
                            <ul class="news-tabs__nav nav nav-tabs shadow_text" role="tablist">
                                {foreach name='new_comment' item='vv'}
                                <li role="presentation" class="active">
                                    <a href="#home" role="tab" data-toggle="tab">
                                        <span class="time">{$vv.comment_time}</span>
                                        {$vv.comment_content}
                                    </a>
                                </li>
                                {/foreach}
                            </ul>
                            {/if}
                        </div>
                    </div>
                    <div class="col-sm-12 col-md-9 p0 wrap-headline">
                        <img src="{$info.information_image}" alt="img" class="wrap-headline__img">
                    </div>
                    <div class="col-sm-12 col-md-9 article_text">
                        <div class="current">
                            <h1 class="text-center yel_line current__title">{$info.information_title}</h1>
                            <p class="current__text">{$info.information_content}</p>

                        </div>
                    </div>
                    <div class="col-sm-12 col-md-9 tags">
                        {notempty name='info.information_label'}
                        <p>标签:</p>
                        <ul>
                            <li>
                                <a class="font">{$info.information_label}</a>
                            </li>
                        </ul>
                        {/notempty}
                    </div>
                    <div class="col-sm-9 col-md-8 col-lg-6 comments">
                        <p class="comments__title">评论</p>
                        {notempty name='comment'}
                        {foreach name='comment' item='vo'}
                        <div class="comments__media">
                            <div class="media-middle">
                                <i class="media-object" style="background-image: url('/static/index/img/thumb.jpg')"></i>
                                <div class="comm_info">
                                    <h4 class="media-heading">{$vo.comment_user_name}</h4>
                                    <span class="time">{$vo.comment_time}</span>
                                </div>
                            </div>
                            <p class="media-body">{$vo.comment_content}</p>
                        </div>
                        {/foreach}
                        {/notempty}
                        <div class="comments__form">
                            <form action="#" method="POST" id="sendComment">
                                <div class="form-group">
                                    <textarea name="comment_content" id="input" class="form-control" rows="7" required="required" {if $denglu == 0}placeholder="评论前请先登录"{/if}></textarea>
                                </div>
                                <input type="hidden" name="information_id" value="{$info.information_id}" id="information_id">
                                {if $denglu == 1}
                                <button type="button" class="btn btn-comment btn-comment222">评论</button>
                                {else /}
                                <button type="button" class="btn btn-comment" onclick="location.href = '/index/Login/indexLogin';">去登录</button>
                                {/if}
                            </form>
                        </div>
                    </div>
                </div>
            </article>
        </div>
        <!-- Footer -->
        {include file="public/footer"}
        <!-- END Footer -->
        <!-- All JavaScript libraries -->
    </body>
</html>
<script>
    var information_id; // 资讯ID
    var comment_content; // 评论内容
    // 发布评论
    $('.btn-comment222').click(function () {
        information_id = $('#information_id').val();
        comment_content = $('#input').val();
        if(comment_content.trim() == ''){
            alert('请填写内容');
            return;
        }
        $.ajax({
            url:'{:url("index/Index/publishComment")}',
            type:'post',
            data:$('#sendComment').serialize(),
            dataType:'json',
            success:function (data) {
                if(data.status == 200){
                    alert(data.msg);
                    window.location.reload();
                }else if(data.status == 202){
                    alert(data.msg);
                    location.href = '{:url("index/Login/indexLogin")}';
                }else {
                    alert(data.msg);
                }
            }
        })
    });
</script>

